'use strict'

import dispatcher from './dispatcher'
import constants from './constants'

export default {
    // 接受订单
    accept: (id, success) => {
        dispatcher.dispatch({
            actionType: constants.ACCEPT,
            id: id,
            success: success
        })
    },

    // 拒绝接单
    reject: (id, reason, success) => {
        dispatcher.dispatch({
            actionType: constants.REJECT,
            id: id,
            reason: reason,
            success: success
        })
    },

    // 取消订单
    cancel: (id, reason, success) => {
        dispatcher.dispatch({
            actionType: constants.CANCEL,
            id: id,
            reason: reason,
            success: success
        })
    },

    // 完成订单
    complete: (id, reason, success) => {
        dispatcher.dispatch({
            actionType: constants.COMPLETE,
            id: id,
            success: success
        })
    },

    // 重新安排
    reSchedule: (id, time, success) => {
       dispatcher.dispatch({
           actionType: constants.RESCHEDULE,
           id: id,
           time: time,
           success: success
       })
    }

}
